home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d19 / prokit33.arc / CALLS.DOC < prev    next >
Text File  |  1990-06-27  |  10KB  |  314 lines

  1.  
  2. (*
  3.  * CALLS.DOC - DOOR support functions provided by ProKIT
  4.  *
  5.  * (C) 1988 Samuel H. Smith (rev. 04-aug-88)
  6.  *
  7.  *)
  8.  
  9. procedure init;
  10. {must be first - opens com port, loads setup and user data}
  11.  
  12. procedure load_cnames_file;
  13. {make conference information available}
  14.  
  15. procedure load_conf(n: integer);
  16. {select a conference by number 0..2040; selected conference information
  17.  is placed into conf_info}
  18.  
  19. procedure uninit;
  20. {must be last - closes com port and updates database}
  21.  
  22. procedure close_down_door(messages: boolean);
  23. {same as uninit but does not send ANY messages to the caller
  24.  if called as close_down_door(false)}
  25.  
  26.  
  27. (* ---------------------------------------------------------------- *)
  28. (* high level input and output *)
  29.  
  30. procedure disp(msg: string);
  31.    {display a string without linefeed}
  32.  
  33. procedure displn(msg: string);
  34.    {display a string and linefeed, increments linenum}
  35.  
  36. procedure pdisp(msg: string);
  37.    {display a string without linefeed, allows $ and @ macros}
  38.  
  39. procedure pdispln(msg: string);
  40.    {display a string and linefeed, increments linenum, allows $ and @ macros}
  41.  
  42. procedure newline;
  43.    {C/R and linefeed, increments linenum}
  44.  
  45.    
  46. procedure display_file(name: string);
  47.    {displays the contents of named file;
  48.     automatic "more:" prompting;
  49.     adds "g" to filename in graphics mode}
  50.  
  51. procedure display_file_raw(name: string; number_lines);
  52.    {display a file with line numbers added}
  53.  
  54.  
  55. procedure input(var line: string;       {the variable to input into}
  56.                 maxlen: integer);       {maximum length of input}
  57.    {read a line of input with the specified length; echo to screen;
  58.     leaves cursor after the last key typed before C/R;
  59.     automatic check for time-left and carrier loss - sets dump_user}
  60.  
  61. procedure get_cmdline;      
  62.    {calls 'input' to read into 'cmdline', maps to upper case}
  63.  
  64. procedure get_nextpar;      
  65.    {scan next param from 'cmdline' into 'par'}
  66.  
  67. procedure wait_for_enter;   
  68.    {prompt "Press (enter) to continue: " only in novice mode}
  69.  
  70. procedure force_enter;
  71.    {prompt "Press (enter) to continue: "}
  72.  
  73. procedure position(x,y: byte);
  74.    {position cursor; graphics mode only}
  75.  
  76. procedure clear_screen;
  77.    {ease screen in current color; graphics mode only}
  78.  
  79. procedure clear_eol;
  80.    {clear to end of line; graphics mode only}
  81.  
  82.  
  83.  
  84. (* ---------------------------------------------------------------- *)
  85. (* high-level command-line input and prompt handlers *)
  86.  
  87. procedure get_cmdline_raw(prelength: integer);
  88.    {get a command line; prelength=0 for normal prompts.
  89.     if prelength > 0 then the user input and a prompt of prelength
  90.     characters will be erased from the screen after the input}
  91.  
  92. procedure prompt_def(prompt: string80; default: string80);
  93.    {display a prompt with a default value; example:
  94.         prompt_def('File to open:','(Enter)=none? ');}
  95.  
  96. procedure get_def(prompt: string80; default: string80);
  97.    {get input after displaying a prompt with a default}
  98.  
  99. procedure get_defn(prompt: string80; default: string80);
  100.    {same as get_def but appends '(Enter)=none?' to the end of the default}
  101.  
  102. procedure get_defen(prompt: string80);
  103.    {same as get_def but the default is always '(Enter)=none?'}
  104.  
  105. procedure get_defyn(prompt: string80; default: boolean);
  106.    {get input with yes/no default based on boolean value}
  107.  
  108.  
  109.  
  110. (* ---------------------------------------------------------------- *)
  111. (* low level input and output *)
  112.  
  113. function nomore: boolean;      
  114.    {prompts "more?" when needed, 
  115.     returns TRUE if user answers 'no' or uses ^K}
  116.  
  117. procedure display_file_raw(name: string; remove_semicolons);
  118.    {display a file with semicolons in column 1 changed to spaces (script0)}
  119.  
  120. procedure display_file_raw(name: string; remove_paths);
  121.    {display a file with all drive and directory names excluded}
  122.  
  123. procedure display_file_raw(name: string; dir_colorize);
  124.    {display a DIR file with automatic colorization}
  125.  
  126.  
  127. function get_key: char;        
  128.    {wait for single key; no echo}
  129.  
  130. function key_ready: boolean;
  131.    {is a key waiting (local or remote)}
  132.  
  133. function time_key(ms: real): char;
  134.    {wait for a key; returns chr(0) if no key is pressed with
  135.     'ms' thousandths of a second}
  136.  
  137.  
  138. procedure check_carrier_loss;   
  139.    {set dump_user and print msg on carrier loss}
  140.  
  141. function carrier_present: boolean;
  142.    {returns TRUE only if carrier is present}
  143.  
  144. procedure transmit_data(s:    string);
  145.    {send a string to the modem without echo to the local display}
  146.  
  147. procedure flush_com;
  148.    {wait for all requested output to be sent to the modem}
  149.  
  150. procedure lower_dtr;
  151.    {force the modem to hang-up}
  152.  
  153. procedure raise_dtr;
  154.    {allow the modem to operate again}
  155.  
  156. procedure force_offhook;
  157.    {hang up and then place the  modem off-hook}
  158.  
  159.  
  160. procedure line_input(var line: string;     {read input into this variable}
  161.                      maxlen:   integer;    {maximum length of input}
  162.                      echo:     boolean;    {echo to screen? dots if false}
  163.                      autocr:   boolean);   {automatic C/R when full?}
  164.    {line input with full control}
  165.  
  166. function scan_nextpar(var cmdline: string): string;
  167.    {scan a string and return the next ";" or " " delimited parameter;
  168.     removes the param from the input string; used in command stacking}
  169.  
  170. procedure popup_prompt(prompt: string; var answer: string);
  171.    {prompt for input; erase prompt afterwards}
  172.  
  173.  
  174. (* ---------------------------------------------------------------- *)
  175. (* color control *)
  176.  
  177. function aBLUE:    string;
  178. function aCYAN:    string;      {output ansi color codes}
  179. function aGRAY:    string;      {return null strings in non-graphic mode}
  180. function aGREEN:   string;
  181. function aGREY:    string;
  182. function aMAGENTA: string;
  183. function aRED:     string;
  184. function aWHITE:   string;
  185. function aYELLOW:  string;
  186.  
  187. procedure default_color;
  188.    {change display to the default color (as defined in pcbsetup)}
  189.  
  190.  
  191. (* ---------------------------------------------------------------- *)
  192. (* pcboard information functions *)
  193.  
  194. function expert:   boolean;        {expert flag set?}
  195. function graphics: boolean;        {ansi graphics flag set?}
  196. function local:    boolean;        {local mode?, no com port}
  197.  
  198.  
  199. function minutes_left: integer;
  200.    {minutes left before automatic logoff}
  201.  
  202. function time_used: integer;       
  203.    {minutes used since login}
  204.  
  205. procedure adjust_time_allowed(seconds: real);
  206.    {add or subtract online time}
  207.  
  208. procedure check_time_left;
  209.    {print a message and set dump_user if time has run out}
  210.  
  211. procedure display_time(true);
  212.    {display (xxxx used, xxxx left)}
  213.  
  214. procedure display_time(false);
  215.    {display (xxxx left)}
  216.  
  217.  
  218. function conference_name: string;      
  219.    {example: 'Main Board' or 'xxxx Conference'}
  220.  
  221. function download_k_allowed: real;
  222.    {how many K bytes are left for downloading?}
  223.  
  224.  
  225. function event_run_needed(event_now): boolean;
  226.    {will event be started immediately if the caller logs off right now?}
  227.  
  228. function event_run_needed(event_possible): boolean;
  229.    {will the event be due if the caller uses all available time}
  230.  
  231. function minutes_before_event: integer;
  232.    {how many minutes before the event is to be started?}
  233.  
  234.  
  235. function verify_level(func: char): boolean;       
  236.    {example:  verify_level('D') = true 
  237.     if pcboard 'D' command is allowed;
  238.     logs security violation if not}
  239.    
  240. procedure make_log_entry (entry: string;        {message to log}
  241.                           echo: boolean);       {also display if true}
  242.    {make an entry in caller log; 
  243.     also echo to screen if second param is TRUE}
  244.  
  245. procedure chat_mode;
  246.    {activate sysop-chat mode}
  247.  
  248. procedure operator_page;
  249.    {page sysop and possibly enter chat mode}
  250.  
  251. procedure online_user_update;
  252.    {edit user password, phone numbers, security level, conference
  253.     registrations, etc}
  254.  
  255.  
  256. (* ---------------------------------------------------------------- *)
  257. (* utilities *)
  258.  
  259. procedure replace_string( var line: string; oldstr, newstr: string);
  260.    {scans line and replaces all occurences of 'oldstr' with 'newstr'}
  261.  
  262. procedure stoupper(var st: string);  
  263.    {map string to all upper case}
  264.  
  265. procedure strip_trailing(var s: string);
  266.    {remove trailing spaces from a string variable}
  267.  
  268. function get_environment_var(id: string): string;
  269.    {returns the value of an envionment variable;
  270.     example: get_environment_var('PATH=') returns "C:\;C:\BATCH..."}
  271.  
  272.  
  273. function get_time: real;  
  274.    {returns the time of day in seconds since midnight}
  275.  
  276. function todays_date_mmddyy: string8;   {format: mmddyy}
  277. function todays_date_yymmdd: string8;   {format: yymmdd}
  278. function system_date: string;           {format: mm-dd-yy}
  279. function system_time: string;           {format: hh:mm}
  280.  
  281. function expdate(yymmdd: string): string;
  282.    {convert mmddyy to mm-dd-yy}
  283. function mmddyy_to_yymmdd(mmddyy: string8): string8;
  284.    {convert mmddyy to yymmdd}
  285. function yymmdd_to_mmddyy(yymmdd: string8): string8;
  286.    {convert yymmdd to mmddyy}
  287.  
  288.  
  289.  
  290. (* ---------------------------------------------------------------- *)
  291. (* data type conversion *)
  292.  
  293. function wtoa(w:   word):    string;   {word to ascii}
  294. function ltoa(int: longint): string;   {longint to ascii}
  295. function itoa(int: integer): string;   {integer to ascii}
  296.  
  297. function atof(asc: string):  real;     {ascii to float}
  298. function atoi(asc: string):  integer;  {ascii to integer}
  299. function atol(asc: string):  longint;  {ascii to longint}
  300. function atow(asc: string):  word;     {ascii to word}
  301.  
  302.  
  303. function ftoa(f: real; width,dec: integer): string;
  304.    {convert pascal floating to string with specified width and decimal places}
  305.  
  306. function stof(B: single): real; {convert 4 byte single (basic format) to real}
  307. function dtof(B: double): real; {convert 8 byte double (basic format) to real}
  308. procedure ftod(PasReal: real; var B: double); {convert real to 8 byte double}
  309. procedure ftos(PasReal: real; var B: single); {convert real to 4 byte single}
  310.  
  311. function stoa(s: single): string;       {convert single to ascii}
  312. function stol(s: single): longint;      {convert single to longint}
  313.  
  314.